const Router = require('koa-router')
const commentRouter = new Router({ prefix: '/comment' })
const {
  create,
  reply,
  update, remove
} = require('../controller/comment.controller')

const {
  verifyAuth,
  verifyPermission
} = require('../middleware/auth.middleware')
// 发表评论。。 必须要先登录 
commentRouter.post('/', verifyAuth, create)
// 回复评论
commentRouter.post('/reply', verifyAuth, reply)
// 修改评论    只能自己 修改、删除 自己的评论
// commentRouter.patch('/:commentId', verifyAuth, update)

// 修改评论
commentRouter.patch('/:commentId', verifyAuth, verifyPermission, update);
// 删除评论
commentRouter.delete('/:commentId', verifyAuth, verifyPermission, remove);

module.exports = commentRouter